package map;

import java.util.HashMap;
import java.util.Map;

//java.util.Map接口，定义了Map
public class MapDemo {
    public static void main(String[] args) {
        long start=System.currentTimeMillis();
        Map<String,Integer> map=new HashMap<>();
        System.out.println(map);
        map.put("语文",99);
        map.put("数学",150);
        map.put("英语",76);//返回值为null
        map.put("化学",88);
        map.put("物理",60);
        map.put("生物",98);
        System.out.println(map);
        Integer value=map.put("生物",40);
        System.out.println(value);
        System.out.println(map);

        int size=map.size();
        System.out.println(size);
        value= map.get("语文");//巨快
        System.out.println(value);
        value=map.get("体育");
        System.out.println(value);
        long end =System.currentTimeMillis();
        System.out.println(end-start);
        value=map.remove("化学");
        System.out.println(value);
        System.out.println(map);
        boolean ck = map.containsKey("化学");
        boolean cv = map.containsValue(99);
        System.out.println("是否包含Key:"+ck);
        System.out.println("是否包含value"+cv);

    }
}
